package com.rlz.framemm.mode.strategy2

/**
 * Created by RLZ
 * on 2021/10/26
 * 模拟 电影票 环境类
 */
class MovieTicket {
    private var mPrice: Double = 0.0

    private var mDiscount: Discount? = null

    fun setPrice(price: Double) {
        mPrice = price
    }

    fun setDiscount(discount: Discount) {
        mDiscount = discount
    }

    fun getPrice(): Double {
        return mDiscount.let {
            it?.calculate(mPrice)!!
        }
    }
}
